package com.bafa.services;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeMap;

import com.bafa.dbcache.LeagueCache;
import com.bafa.objects.Award;

public class AwardsServices {

	
	public static Award[] getLeagueAwards(){
		ArrayList awards = new ArrayList();
		TreeMap awardsBySeasonMap = LeagueCache.getLeagueAwards();
		
		Iterator itr = awardsBySeasonMap.values().iterator();
		while(itr.hasNext()){
			TreeMap awardsByDivisionMap = (TreeMap)itr.next();
			Iterator itr1 = awardsByDivisionMap.values().iterator();
			while(itr1.hasNext()){
				awards.add((Award)itr1.next());
			}
		}
		
		
		
		return (Award[])awards.toArray(new Award[awards.size()]);
	}
	
	public static void main(String[] args) {
		LeagueCache.refreshAll();
		System.out.println(getLeagueAwards().length);
	}
}
